/*
 * Copyright 2008 Johnny Jian
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.googlecode.getris.game.score

import static org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test

class ScoreKeeperTest {

	def score

	@Before void setUp() {
		score = new ScoreKeeper()
	}

	@Test void testConstructor() {
		assertEquals 0, score.score
		assertEquals 0, score.lines
		assertEquals 1, score.level
	}

	@Test void testAddLines() {
		score.addLines 1
		assertEquals 1, score.lines
		assertEquals 10, score.score
		assertEquals 1, score.level

		score.addLines 2
		assertEquals 3, score.lines
		assertEquals 35, score.score
		assertEquals 1, score.level

		score.addLines 3
		assertEquals 6, score.lines
		assertEquals 80, score.score
		assertEquals 1, score.level

		score.addLines 4
		assertEquals 10, score.lines
		assertEquals 150, score.score
		assertEquals 2, score.level

		score.addLines 1
		assertEquals 11, score.lines
		assertEquals 170, score.score
		assertEquals 2, score.level

		score.addLines 4
		assertEquals 15, score.lines
		assertEquals 310, score.score
		assertEquals 2, score.level
	}

}
